package com.harlan.viewbindingstudy;


import android.os.Bundle;

import android.view.View;

import com.harlan.viewbindingstudy.databinding.ActivityMainBinding;

import java.util.ArrayList;
import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

public class MainActivity extends AppCompatActivity {
    ActivityMainBinding binding;
    List<Fragment> fragments = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        View rootView = binding.getRoot();
        setContentView(rootView);
        FragmentManager manager = getSupportFragmentManager();

        fragments.add(new BlankFragment());
        fragments.add(new BlankFragment2());
        fragments.add(new BlankFragment3());
        FragmentAdpter adpter = new FragmentAdpter(manager, fragments);
        binding.viewpager.setAdapter(adpter);
        //  binding.viewpager.setOffscreenPageLimit();
    }
}